home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Travel to Space
/
Travel to Space.iso
/
dos_prog
/
astrolgy
/
moonph
/
moonph.bas
< prev
next >
Wrap
BASIC Source File
|
1991-08-06
|
9KB
|
181 lines
100 '*************************************************************************
200 '* PHASES OF THE MOON *
300 '* *
400 '* Programmer: Daniel P. Franco *
500 '* *
600 '* VERSION 1.0.0 *
700 '* March 8, 1987 *
800 '* [73307,3471] *
900 '* *
1000 '* This program calculates the phase of the moon for a given year *
1100 '* and month. The user inputs the year, the month, and the number of *
1200 '* consecutive months data are required for. Output includes Ephemeris *
1300 '* Time of each phase beginning with the new moon. *
1400 '* *
1500 '*************************************************************************
1600 '*************************************************************************
1700 '* *
1800 '* INPUT SECTION *
1900 '* *
2000 '*************************************************************************
2100 CLS
2200 DEFDBL A-Z
2300 PRINT "Enter Year:"
2400 INPUT YEAR
2500 LEAP=YEAR MOD 4 'if leap = 0 then year is a leap year
2600 PRINT "Enter Month:"
2700 INPUT MONTH
2800 PRINT "Output For How Many Months:"
2900 INPUT COUNT
3000 IF LEAP <> 0 THEN 3400 ELSE 4700
3100 '**************************************************************************
3200 '* CALCULATION FOR DECIMAL YEARS *
3300 '**************************************************************************
3400 IF MONTH = 1 THEN YD = .0424375935815675#
3500 IF MONTH = 2 THEN YD = .1232059168497121#
3600 IF MONTH = 3 THEN YD = .2039742401178567#
3700 IF MONTH = 4 THEN YD = .2874804726493282#
3800 IF MONTH = 5 THEN YD = .3709867051807998#
3900 IF MONTH = 6 THEN YD = .4544929377122713#
4000 IF MONTH = 7 THEN YD = .5379991702437429#
4100 IF MONTH = 8 THEN YD = .6228743574068778#
4200 IF MONTH = 9 THEN YD = .7063805899383494#
4300 IF MONTH = 10 THEN YD = .7898868224698209#
4400 IF MONTH = 11 THEN YD = .8733930550012924#
4500 IF MONTH = 12 THEN YD = .956899287532764#
4600 GOTO 6000
4700 IF LEAP = 0 GOTO 4800
4800 IF MONTH = 1 THEN YD = .0424375935815675#
4900 IF MONTH = 2 THEN YD = .1245748714813756#
5000 IF MONTH = 3 THEN YD = .2053431947495202#
5100 IF MONTH = 4 THEN YD = .2888494272809917#
5200 IF MONTH = 5 THEN YD = .3723556598124632#
5300 IF MONTH = 6 THEN YD = .4558618923439348#
5400 IF MONTH = 7 THEN YD = .5393681248754063#
5500 IF MONTH = 8 THEN YD = .6242433120385413#
5600 IF MONTH = 9 THEN YD = .7077495445700128#
5700 IF MONTH = 10 THEN YD = .7912557771014844#
5800 IF MONTH = 11 THEN YD = .8747620096329559#
5900 IF MONTH = 12 THEN YD = .9582682421644275#
6000 K = ((YEAR+YD) - 1900) * 12.3685
6100 K = CINT(K)
6200 COUNT = K + COUNT
6300 T = K/1236.85
6400 T2 = T ^ 2
6500 T3 = T ^ 3
6600 PI=3.141592653589793#
6700 R=PI/180
6800 '**************************************************************************
6900 '* SUN MEAN ANOMALY *
7000 '**************************************************************************
7100 SMA = 359.2242 + (29.10535608# * K)-(.0000333*T2)-(3.47E-06*T3)
7200 IF SMA > 360 THEN SMA=SMA/360:SMA=SMA-FIX(SMA):SMA=SMA*360
7300 '**************************************************************************
7400 '* MOON MEAN ANOMALY *
7500 '**************************************************************************
7600 MMA = 306.0253+(385.81691806#*K)+(.0107306*T2)+(1.236E-05*T3)
7700 IF MMA > 360 THEN MMA=MMA/360:MMA=MMA-FIX(MMA):MMA=MMA*360
7800 '**************************************************************************
7900 '* MOON'S ARGUMENT OF LATITUDE *
8000 '**************************************************************************
8100 F = 21.2964+(390.67050646#*K)-(.0016528*T2)-(2.39E-06*T3)
8200 IF F > 360 THEN F=F/360:F=F-FIX(F):F=F*360
8300 '**************************************************************************
8400 '* MEAN PHASE OF THE MOON *
8500 '**************************************************************************
8600 JD=2415020.75933#+(29.53058868#*K)+(.0001178*T2)-(1.55E-07*T3)+(.00033*SIN((R*166.56)+(R*132.87)*T)-((R*.009173*T2)))
8700 SMA=SMA*R
8800 MMA=MMA*R
8900 F=F*R
9000 '**************************************************************************
9100 '* TRUE PHASE CORRECTIONS FOR NEW AND FULL MOON *
9200 '**************************************************************************
9300 IF K-FIX(K)=0 OR K-FIX(K) =.5 OR K-FIX(K)=-.5 THEN 9400 ELSE 11100
9400 JD=JD+((.1734-.000393*T)*SIN(SMA))
9500 JD=JD+(.0021*SIN(2*SMA))
9600 JD=JD-(.4068*SIN(MMA))
9700 JD=JD+(.0161*SIN(2*MMA))
9800 JD=JD-(.0004*SIN(3*MMA))
9900 JD=JD+(.0104*SIN(2*F))
10000 JD=JD-(.0051*SIN(SMA+MMA))
10100 JD=JD-(.0074*SIN(SMA-MMA))
10200 JD=JD+(.0004*SIN((2*F)+SMA))
10300 JD=JD-(.0004*SIN((2*F)-SMA))
10400 JD=JD-(6.000001E-04*SIN((2*F)+MMA))
10500 JD=JD+(.001*SIN((2*F)-MMA))
10600 JD=JD+.0005*SIN(SMA+(2*MMA))
10700 GOTO 14300
10800 '*************************************************************************
10900 '* TRUE PHASE CORRECTIONS FOR FOR FIRST AND LAST QUARTER *
11000 '*************************************************************************
11100 JD=JD+(.1721-.0004*T)*SIN(SMA)
11200 JD=JD+.0021*SIN(2*SMA)
11300 JD=JD-.628*SIN(MMA)
11400 JD=JD+.0089*SIN(2*MMA)
11500 JD=JD-.0004*SIN(3*MMA)
11600 JD=JD+.0079*SIN(2*F)
11700 JD=JD-.0119*SIN(SMA+MMA)
11800 JD=JD-.0047*SIN(SMA-MMA)
11900 JD=JD+.0003*SIN(2*F+SMA)
12000 JD=JD-.0004*SIN(2*F-SMA)
12100 JD=JD-6.000001E-04*SIN(2*F+MMA)
12200 JD=JD+.0021*SIN(2*F-MMA)
12300 JD=JD+.0003*SIN(SMA+2*MMA)
12400 JD=JD+.0004*SIN(SMA-2*MMA)
12500 JD=JD-.0003*SIN(2*SMA-MMA)
12600 '*************************************************************************
12700 '* ADDITIONAL FIRST QUARTER CORRECTION *
12800 '*************************************************************************
12900 IF K => 0 AND K-FIX(K) = .25 THEN 13100 ELSE 13000
13000 IF K < 0 AND K-FIX(K)=-.75 THEN 13100 ELSE 13600
13100 JD=JD+.0028-.0004*COS(SMA)+.0003*COS(MMA)
13200 GOTO 14300
13300 '*************************************************************************
13400 '* ADDITIONAL LAST QUARTER CORRECTION *
13500 '*************************************************************************
13600 IF K => 0 AND K-FIX(K) = .75 THEN 13800 ELSE 13700
13700 IF K < 0 AND K-FIX(K) =-.25 THEN 13800 ELSE 14300
13800 JD=JD-.0028+.0004*COS(SMA)-.0003*COS(MMA)
13900 GOTO 14300
14000 '*************************************************************************
14100 '* CALENDAR DATE CALCULATION *
14200 '*************************************************************************
14300 JD=JD+.5
14400 Z=INT(JD)
14500 FRAC=JD-FIX(JD)
14600 IF Z < 2299161! THEN A=Z
14700 IF Z => 2299161! THEN ALPHA=INT((Z-1867216.25#)/36524.25)
14800 IF Z => 2299161! THEN A=Z+1+ALPHA-INT(ALPHA/4)
14900 B=A+1524
15000 C=INT((B-122.1)/365.25)
15100 D=INT(365.25*C)
15200 E=INT((B-D)/30.6001)
15300 DOM=B-D-INT(30.6001*E)+FRAC
15400 IF E<13.5 THEN M=E-1
15500 IF E>13.5 THEN M=E-13
15600 IF M>2.5 THEN Y=C-4716
15700 IF M<2.5 THEN Y=C-4715
15800 DAYINT=INT(DOM)
15900 DAYFRAC=DOM-FIX(DOM)
16000 TOTSEC=DAYFRAC*86400!
16100 TOTHOURS=(TOTSEC/60)/60
16200 HOUR =INT(TOTHOURS)
16300 MINLEFT=TOTHOURS-FIX(TOTHOURS)
16400 TOTMIN=(MINLEFT*60)
16500 MIN=INT(TOTMIN)
16600 SECLEFT=TOTMIN-FIX(TOTMIN)
16700 SEC=(SECLEFT*60)
16800 IF K => 0 AND K-FIX(K)=0 THEN PHASE$="NEW MOON"
16900 IF K=> 0 AND K-FIX(K)=.25 THEN PHASE$="FIRST QUARTER"
17000 IF K=> 0 AND K-FIX(K)=.5 THEN PHASE$="FULL MOON"
17100 IF K=> 0 AND K-FIX(K)=.75 THEN PHASE$="LAST QUARTER"
17200 IF K < 0 AND K-FIX(K) = 0 THEN PHASE$="NEW MOON"
17300 IF K < 0 AND K-FIX(K) = -.75 THEN PHASE$="FIRST QUARTER"
17400 IF K < 0 AND K-FIX(K) = -.5 THEN PHASE$="FULL MOON"
17500 IF K < 0 AND K-FIX(K) = -.25 THEN PHASE$="LAST QUARTER"
17600 PRINT USING "#### ## ## ## \ \ ## \ \ ##.## \ \ \ \";Y,M,DAYINT,HOUR,"Hours",MIN,"Min.",SEC,"Sec.",PHASE$
17700 K=K+.25
17800 IF K = COUNT GOTO 18000
17900 GOTO 6300
18000 END